/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.arg.deploy.webapp.tag.monitor.ctrl;

import com.arg.deploy.bean.Tag;
import com.arg.deploy.webapp.common.DeployCheckboxRenderer;
import static com.arg.deploy.webapp.common.DeployRowRenderer.LEFT_CELL_STYLE;
import org.apache.log4j.Logger;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Row;

/**
 *
 * @author sorasaks
 */
public class TagMonitorNormalMainRenderer extends DeployCheckboxRenderer {
    
    private static final Logger LOG = Logger.getLogger(TagMonitorNormalMainRenderer.class);
    
    public TagMonitorNormalMainRenderer(Checkbox chkAll, Grid grid) {
        setChkAll(chkAll);
        setGrid(grid);
    }
    
    @Override
    protected void gridRender(Row row, Object o, int i) throws Exception {
        refreshRenderer();
        Tag object = (Tag) o;
        
        LOG.info("::::::::::::::::::::::::::::::::::::::::: object.getIsLasted() = " + object.getIsLasted());
        
        if (!object.getIsLasted()) {
            row.setStyle("background-color: yellow;");
        }
        
        appendCellInRow(row, createCheckboxInCell(object, LEFT_CELL_STYLE, row, i));
        appendCellInRow(row, createLabelInCell(String.valueOf(i + 1), CENTER_CELL_STYLE));
        appendCellInRow(row, createLabelInCell(object.getIssue(), LEFT_CELL_STYLE));
        appendCellInRow(row, createLabelInCell(object.getFilename(), LEFT_CELL_STYLE));
        appendCellInRow(row, createLabelInCell(object.getVersion(), LEFT_CELL_STYLE));
        appendCellInRow(row, createLabelInCell(object.getRevision(), LEFT_CELL_STYLE));
        appendCellInRow(row, createLabelInCell(object.getPath(), LEFT_CELL_STYLE));
        appendCellInRow(row, createLabelInCell(object.getUser().getUsername(), LEFT_CELL_STYLE));
        appendCellInRow(row, createLabelInCell(object.getMode(), LEFT_CELL_STYLE));
    }
}
